﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Chapter25
{
    using Chapter25.View;

    /// <summary>
    /// 第 25 章 菜单、工具栏和功能区
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            #region 01 菜单
            /*
             * 01 Menu 菜单
             * 02 菜单项
             * 03 ContextMenu 类
             * 04 菜单分隔条
             * */
            #endregion

            #region 02 工具栏和和状态栏
            #endregion

            #region 03 功能区
            #endregion

            #region 04 小结
            #endregion
        }

        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Command == ApplicationCommands.Open)
            {
                if ((Button)e.Source == button1)
                {
                    var window = new ThreeMixedMenusWindow();
                    Demo(window);
                }
                if ((Button)e.Source ==button2)
                {
                    var window = new SiderbarMenuWindow();
                    Demo(window);
                }
                if ((Button)e.Source == button3)
                {
                    var window = new BasicMenuWindow();
                    Demo(window);
                }
                if ((Button)e.Source == button4)
                {
                    var window = new MenuWithSubHeading();
                    Demo(window);
                }
                if ((Button)e.Source == button5)
                {
                    var window = new BasicToolbarWindow();
                    Demo(window);
                }
                if ((Button)e.Source == button6)
                {
                    var window = new ToolbarTraysWindow();
                    Demo(window);
                }
                if ((Button)e.Source == button7)
                {
                    var window = new StatusBarWindow();
                    Demo(window);
                }
                if ((Button)e.Source == button8)
                {
                    var window = new DerivedRibbonWindow();
                    Demo(window);
                }
            }
        }

        private void Demo(Window window)
        {
            window.Owner = this;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.ShowDialog();
        }
    }
}
